package com.niiwoo.civet.mobile.vo.request.loan;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.List;

/**
 * @Description: 申请借款请求
 * @Author:wuke
 * @Date:2017/10/17
 */
@Setter
@Getter
@ApiModel(value = "申请借款请求")
public class SpeedLoanApplyRequestVO {

    @NotNull(message = "借款来源不能为空")
    @ApiModelProperty(value = "标的申请来源（1、APP，2、H5活动，3、H5极速借, 4、融360）", required = true)
    private Byte fromSource;

    @NotNull(message = "借款金额不能为空")
    @DecimalMin(value="0",message = "借款金额不能小于0")
    @ApiModelProperty(value = "借款金额", required = true)
    private BigDecimal loanAmount;

    @NotNull(message = "借款期限不能为空")
    @ApiModelProperty(value = "借款期限", required = true)
    private Integer deadline;

    @NotNull(message = "借款标题不能为空")
    @ApiModelProperty(value = "借款标题")
    private String loanTitle = "";

    @NotNull(message = "经度不能为空")
    @ApiModelProperty(value = "经度")
    private String longitude;

    @NotNull(message = "纬度不能为空")
    @ApiModelProperty(value = "纬度")
    private String latitude;

    @NotNull(message = "省份不能为空")
    @ApiModelProperty(value = "省份")
    private String province;

    @NotNull(message = "城市不能为空")
    @ApiModelProperty(value = "城市")
    private String city;

    @NotNull(message = "区不能为空")
    @ApiModelProperty(value = "区")
    private String area;

    @ApiModelProperty(value = "借款描述", required = true)
    private String loanDesc;

    @ApiModelProperty(value = "使用红包Id")
    private Long prizeId;

    @ApiModelProperty(value = "使用红包类型")
    private Byte prizeType;

    @NotNull(message = "通讯录不能为空")
    @Size(min = 1,message = "通讯录不能为空")
    @ApiModelProperty(value = "通讯录")
    private List<AddressInfoVO> addressInfoVOList;

    @Valid
    @NotNull(message = "借款设备信息不能为空")
    @ApiModelProperty(value = "借款设备信息")
    private DeviceInfoRequestVO deviceInfo;

    @Setter
    @Getter
    public static class AddressInfoVO{
        @ApiModelProperty(value = "手机号码")
        private String mobile;

        @ApiModelProperty(value = "联系人姓名")
        private String remark;
    }

    @Setter
    @Getter
    public static class DeviceInfoRequestVO{
        @NotNull(message = "设备ID不能为空")
        @ApiModelProperty(value = "设备ID,安卓用imei,ios用idfa")
        private String  deviceId;

        @Pattern(regexp="Android|iOS",message="操作系统类型错误")
        @ApiModelProperty(value = "操作系统,Android or iOS")
        private String  os;

        @ApiModelProperty(value = "品牌类型")
        private String  brandType;

        @ApiModelProperty(value = "是否双卡双待（0：否   1：是）")
        private Byte    dsds;

        @ApiModelProperty(value = "设备状态（0：未越狱  1：已越狱）")
        private Byte    deviceStatus;

        @ApiModelProperty(value = "借款时GPS")
        private String  gps;

        @ApiModelProperty(value = "借款时IP")
        private String  ip;

        @ApiModelProperty(value = "借款时网络类型")
        private String  network;

        @ApiModelProperty(value = "WiFi的SSID")
        private String  wifiSsid;

        @ApiModelProperty(value = "地图类型（0-高德 1-百度）")
        private Byte mapType;

        @ApiModelProperty(value = "设备指纹信息")
        private String blackBox;
    }
}
